package cn.dz.service.impl;

import cn.dz.entity.Employee;
import cn.dz.mapper.EmployeeMapper;
import cn.dz.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class EmployeeServiceImpl implements EmployeeService {

    private EmployeeMapper employeeMapper;

    @Autowired
    public EmployeeServiceImpl(EmployeeMapper employeeMapper) {
        this.employeeMapper = employeeMapper;
    }

    @Override
    public List<Employee> lists() {
        return employeeMapper.lists();
    }

    @Override
    public void save(Employee employee) {
        employeeMapper.save(employee);
    }

    @Override
    public Employee findById(Integer id) {
        Employee employee = employeeMapper.findById(id);
        return employee;
    }

    @Override
    public void update(Employee employee) {
        employeeMapper.update(employee);
    }

    @Override
    public void delete(int id) {
        employeeMapper.delete(id);
    }
}
